# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=pueue
pkgver=2.0.2
pkgrel=0
pkgdesc="Manage your shell commands"
url="https://github.com/nukesor/pueue"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le"  # limited by rust/cargo
arch="$arch !ppc64le" # Fails to build 'ring v0.16.19'
license="MIT"
checkdepends="bash"
makedepends="cargo"
source="https://github.com/Nukesor/pueue/archive/v$pkgver/$pkgname-$pkgver.tar.gz"

prepare() {
	default_prepare

	# Optimize binary for size.
	cat >> Cargo.toml <<-EOF

		[profile.release]
		codegen-units = 1
		lto = true
		opt-level = "z"
		panic = "abort"
	EOF
	cargo fetch --locked
}

build() {
	cargo build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	cargo install --locked --offline --path . --root="$pkgdir/usr"
	rm "$pkgdir"/usr/.crates*
}

sha512sums="
8ebf1e68912bd849b4b56aeb1094dbd0d729204006695767e366e24467be3d5b9117ce11009666e28a1e537987d246ab36dae8da08f0ebd5fb90183e3043649b  pueue-2.0.2.tar.gz
"
